package com.drg.center.service.impl;

import com.drg.center.dao.EsCaseAngleDAO;
import com.drg.center.dao.EsDataMiningDAO;
import com.drg.center.dao.EsDepartAngleDAO;
import com.drg.center.entity.param.CaseMonitorPageDTO;
import com.drg.center.entity.param.CaseProfitLossDTO;
import com.drg.center.entity.param.DepartServiceEfficiencyDTO;
import com.drg.center.entity.result.*;
import com.drg.center.service.StatisticsFromEsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

/**
 * @Author: zhangxilin
 * @Date: 2024/12/5
 */
@Slf4j
@Service
public class StatisticsFromEsServiceImpl implements StatisticsFromEsService {

    @Autowired
    private EsCaseAngleDAO esCaseAngleDAO;
    @Autowired
    private EsDepartAngleDAO esDepartAngleDAO;
    @Autowired
    private EsDataMiningDAO esDataMiningDAO;

    @Override
    public PatientCaseSttVO overveiw(String departCode, LocalDate startDate, LocalDate endDate) {
        return esCaseAngleDAO.overveiw(departCode, startDate, endDate);
    }

    @Override
    public DrgSttVO drgstt(String departCode, LocalDate startDate, LocalDate endDate) {
        return esCaseAngleDAO.drgstt(departCode, startDate, endDate);
    }

    @Override
    public List<KeyValueVO> getDepartTop5(LocalDate startDate, LocalDate endDate) {
        return esCaseAngleDAO.getDepartTop5(startDate, endDate);
    }

    @Override
    public List<KeyValueVO> getDrgTop5(String departCode, LocalDate startDate, LocalDate endDate) {
        return esCaseAngleDAO.getDrgTop5(departCode, startDate, endDate);
    }

    @Override
    public ProfitLossMixVO getDepartProfitRateStt(LocalDate startDate, LocalDate endDate) {
        return esCaseAngleDAO.getDepartProfitRateStt(startDate, endDate);
    }

    @Override
    public ProfitLossMixVO getDrgProfitRateStt(String departCode, LocalDate startDate, LocalDate endDate) {
        return esCaseAngleDAO.getDrgProfitRateStt(departCode, startDate, endDate);
    }

    @Override
    public List<KeyValueVO> getCostTrend(Integer year) {
        return esCaseAngleDAO.getCostTrend(year);
    }

    @Override
    public List<KeyValueVO> getInDrgTrend(Integer year) {
        return esCaseAngleDAO.getInDrgTrend(year);
    }

    @Override
    public CaseProfitLossAnalysisVO caseProfitLossAnalysis(CaseProfitLossDTO param) {
        return esCaseAngleDAO.caseProfitLossAnalysis(param);
    }

    @Override
    public List<DrgAngleSttVO> getDrgProfitLossList(String departCode, String drgCode, LocalDate startDate, LocalDate endDate) {
        return esDepartAngleDAO.getDrgProfitLossList(departCode, drgCode, startDate, endDate);
    }

    @Override
    public List<DepartProfitLossPageVO> getDepartProfitLossList(String departCode, LocalDate startDate, LocalDate endDate) {
        return esDepartAngleDAO.getDepartProfitLossList(departCode, startDate, endDate);
    }

    @Override
    public List<DepartAngleSttVO> getDepartCostSttList(String departCode, LocalDate startDate, LocalDate endDate) {
        return esDepartAngleDAO.getDepartCostSttList(departCode, startDate, endDate);
    }

    @Override
    public List<MainDataColumnChartVO> getProblemDataByYear(String departCode, List<String> mainSearchDepartCodeList,  LocalDate startDate, LocalDate endDate) {
        return esDataMiningDAO.getProblemDataByYear(departCode, mainSearchDepartCodeList, startDate, endDate);
    }

    @Override
    public List<DepartDataStatVO> getProblemDataByDepart(String departCode, List<String> mainSearchDepartCodeList,  LocalDate startDate, LocalDate endDate) {
        return esDataMiningDAO.getProblemDataByDepart(departCode,mainSearchDepartCodeList, startDate, endDate);
    }

    @Override
    public DataMedicalServerqualityVO getMedicalServerquality(List<String> mainSearchDepartCodeList, LocalDate startDate, LocalDate endDate) {
        return esDataMiningDAO.getMedicalServerquality(mainSearchDepartCodeList,startDate, endDate);
    }

    @Override
    public List<DepartServiceEfficiencyPageVO> getDepartServiceEfficiencyList(DepartServiceEfficiencyDTO param) {
        return esDataMiningDAO.getDepartServiceEfficiencyList(param);
    }

    @Override
    public List<DepartDieRatePageVO> DepartDieRateList(DepartServiceEfficiencyDTO param) {
        return esDataMiningDAO.getDepartDieRateList(param);
    }

    @Override
    public MedicalServiceOverviewVO getMedicalServiceOverview(String departCode,List<String> mainSearchDepartCodeList, LocalDate startDate, LocalDate endDate) {
        return esDataMiningDAO.getMedicalServiceOverview(departCode,mainSearchDepartCodeList, startDate, endDate);
    }

    @Override
    public DifficultCaseDistributeVO getDifficultCaseDistribute(String departCode,List<String> mainSearchDepartCodeList, LocalDate startDate, LocalDate endDate) {
        return esDataMiningDAO.getDifficultCaseDistribute(departCode,mainSearchDepartCodeList, startDate, endDate);
    }

    @Override
    public List<DepartAngleSttVO> getMedicalServiceByDept(String departCode,List<String> mainSearchDepartCodeList, LocalDate startDate, LocalDate endDate) {
        return esDataMiningDAO.getMedicalServiceByDept(departCode,mainSearchDepartCodeList, startDate, endDate);
    }

    @Override
    public CaseMonitorStatVO getCaseMonitorStat(CaseMonitorPageDTO param) {
        return esCaseAngleDAO.getCaseMonitorStat(param);
    }

    @Override
    public ChartLineVO getDepartAvgCostTrend(Integer year, List<String> departCodeList) {
        return esDepartAngleDAO.getDepartAvgCostTrend(year, departCodeList);
    }
}
